﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using BusinessLayer;
using BusinessEntities.Model;
using System.Web.Security;
using System.Configuration;

namespace WebFrontEnd
{
    public abstract class PageBase : Page
    {
        #region Protected Members
        protected IBL _bl;
        #endregion

        #region Protected Properties
        protected IBL BL
        {
            get
            {
                if (_bl == null)
                {
                    _bl = BusinessLayerFactory.GetCurrentBusinessLayer(ConfigurationManager.AppSettings.Get("DomainName"));
                }
                return _bl;
            }
        }
        #endregion

        #region Protected Methods
        protected User GetCurrentUser()
        {
            return BL.GetUserByEmail(User.Identity.Name);
        }
        #endregion
    }
}